package com.zhoust.fastdome.business.controller;

import com.zhoust.fastdome.business.dao.UserMapper;
import com.zhoust.fastdome.business.service.UserService;
import com.zhoust.fastdome.common.CommonResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhoust
 */
@Slf4j
@RestController
public class UserController {

    private final UserMapper userMapper;
    private final UserService userService;
    public UserController(UserMapper userMapper, UserService userService) {
        this.userMapper = userMapper;
        this.userService = userService;
    }

    @GetMapping("/getUserById")
    public CommonResponse getUserById(String id){
        String userById = userService.getUserById(id);
        return CommonResponse.succeed(userById);

    }

    @GetMapping("/getUserByIdException")
    public CommonResponse getUserByIdException(String id){
        String userById = userService.getUserByIdException(id);
        return CommonResponse.succeed(userById);
    }
    @GetMapping("/getUserByIdBusinessException")
    public CommonResponse getUserByIdBusinessException(String id){
        String userById = userService.getUserByIdBusinessException(id);
        return CommonResponse.succeed(userById);
    }
    @GetMapping("/getUserByIdBusinessExceptionByEnumOne")
    public CommonResponse getUserByIdBusinessExceptionByEnumOne(String id){

        String userById = userService.getUserByIdBusinessExceptionByEnumOne(id);
        return CommonResponse.succeed(userById);

    }
    @GetMapping("/getUserByIdBusinessExceptionByEnumTwo")
    public CommonResponse getUserByIdBusinessExceptionByEnumTwo(String id){

        String userById = userService.getUserByIdBusinessExceptionByEnumTwo(id);
        return CommonResponse.succeed(userById);

    }
}
